package cn.wbu.zyh.mapper;

import cn.wbu.zyh.annotation.AutoFill;
import cn.wbu.zyh.dto.ArticlePageQueryDTO;
import cn.wbu.zyh.entity.Article;
import cn.wbu.zyh.entity.Favorites;
import cn.wbu.zyh.enumeration.OperationType;
import com.github.pagehelper.Page;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleMapper {
    Page<Article> pageQuery(ArticlePageQueryDTO articlePageQueryDTO);
    Page<Article> pageQueryByTagId(Long id);
    Page<Article> pageQueryByTeamId(Long teamId,String username);
    Page<Article> findFavoriteArticlesByUser(ArticlePageQueryDTO articlePageQueryDTO);
    @Select("select * from article where id = #{id}")
    Article getById(Long id);

    @AutoFill(OperationType.UPDATE)
    void insert(Article article);
    @AutoFill(OperationType.UPDATE)
    void update(Article article);
    @Delete("delete from article where id = #{id}")
    void deleteById(Long id);

}
